.class public Lcom/glympse/android/glympse/ViewSendGlympse$MessageAutoCompleteAdapter;
.super Landroid/widget/CursorAdapter;
.source "ViewSendGlympse.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/glympse/android/glympse/ViewSendGlympse;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "MessageAutoCompleteAdapter"
.end annotation


# static fields
.field private static final ms_astrMatrixColumns:[Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 3

    .prologue
    .line 1770
    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/String;

    const/4 v1, 0x0

    .line 1771
    const-string v2, "_id"

    aput-object v2, v0, v1

    const/4 v1, 0x1

    .line 1772
    const-string v2, "text"

    aput-object v2, v0, v1

    .line 1769
    sput-object v0, Lcom/glympse/android/glympse/ViewSendGlympse$MessageAutoCompleteAdapter;->ms_astrMatrixColumns:[Ljava/lang/String;

    .line 1767
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "oContext"

    .prologue
    .line 1778
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Landroid/widget/CursorAdapter;-><init>(Landroid/content/Context;Landroid/database/Cursor;)V

    .line 1779
    return-void
.end method


# virtual methods
.method public bindView(Landroid/view/View;Landroid/content/Context;Landroid/database/Cursor;)V
    .locals 1
    .parameter "oView"
    .parameter "oContext"
    .parameter "oCursor"

    .prologue
    .line 1792
    const v0, 0x7f0c0025

    invoke-virtual {p1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p0

    .end local p0
    check-cast p0, Landroid/widget/TextView;

    const/4 v0, 0x1

    invoke-interface {p3, v0}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 1793
    return-void
.end method

.method public bridge synthetic convertToString(Landroid/database/Cursor;)Ljava/lang/CharSequence;
    .locals 1
    .parameter

    .prologue
    .line 1
    invoke-virtual {p0, p1}, Lcom/glympse/android/glympse/ViewSendGlympse$MessageAutoCompleteAdapter;->convertToString(Landroid/database/Cursor;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public convertToString(Landroid/database/Cursor;)Ljava/lang/String;
    .locals 1
    .parameter "oCursor"

    .prologue
    .line 1798
    const/4 v0, 0x1

    invoke-interface {p1, v0}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public newView(Landroid/content/Context;Landroid/database/Cursor;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 4
    .parameter "oContext"
    .parameter "oCursor"
    .parameter "oParent"

    .prologue
    .line 1784
    invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    .line 1785
    .local v0, inflater:Landroid/view/LayoutInflater;
    const v2, 0x7f030017

    const/4 v3, 0x0

    invoke-virtual {v0, v2, p3, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v1

    .line 1786
    .local v1, oView:Landroid/view/View;
    return-object v1
.end method

.method public runQueryOnBackgroundThread(Ljava/lang/CharSequence;)Landroid/database/Cursor;
    .locals 10
    .parameter "oConstraint"

    .prologue
    .line 1805
    if-eqz p1, :cond_0

    invoke-interface {p1}, Ljava/lang/CharSequence;->length()I

    move-result v6

    if-gtz v6, :cond_1

    .line 1807
    :cond_0
    new-instance v6, Landroid/database/MatrixCursor;

    sget-object v7, Lcom/glympse/android/glympse/ViewSendGlympse$MessageAutoCompleteAdapter;->ms_astrMatrixColumns:[Ljava/lang/String;

    invoke-direct {v6, v7}, Landroid/database/MatrixCursor;-><init>([Ljava/lang/String;)V

    .line 1835
    :goto_0
    return-object v6

    .line 1810
    :cond_1
    const/4 v2, 0x0

    .line 1814
    .local v2, oMatrixCursor:Landroid/database/MatrixCursor;
    :try_start_0
    invoke-interface {p1}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v5

    .line 1817
    .local v5, strConstraint:Ljava/lang/String;
    new-instance v3, Landroid/database/MatrixCursor;

    sget-object v6, Lcom/glympse/android/glympse/ViewSendGlympse$MessageAutoCompleteAdapter;->ms_astrMatrixColumns:[Ljava/lang/String;

    const/16 v7, 0x10

    invoke-direct {v3, v6, v7}, Landroid/database/MatrixCursor;-><init>([Ljava/lang/String;I)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1

    .line 1819
    .end local v2           #oMatrixCursor:Landroid/database/MatrixCursor;
    .local v3, oMatrixCursor:Landroid/database/MatrixCursor;
    const/4 v1, 0x0

    .line 1822
    .local v1, nId:I
    :try_start_1
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v6

    iget-object v6, v6, Lcom/glympse/platform/Platform;->m_oMessageList:Lcom/glympse/platform/common/MessageList;

    iget-object v6, v6, Lcom/glympse/platform/common/MessageList;->m_listMessages:Lcom/glympse/platform/GVector$Messages;

    invoke-virtual {v6}, Lcom/glympse/platform/GVector$Messages;->iterator()Ljava/util/Iterator;

    move-result-object v6

    :cond_2
    :goto_1
    invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    move-result v7

    if-nez v7, :cond_3

    move-object v2, v3

    .line 1835
    .end local v1           #nId:I
    .end local v3           #oMatrixCursor:Landroid/database/MatrixCursor;
    .end local v5           #strConstraint:Ljava/lang/String;
    .restart local v2       #oMatrixCursor:Landroid/database/MatrixCursor;
    :goto_2
    if-nez v2, :cond_4

    new-instance v6, Landroid/database/MatrixCursor;

    sget-object v7, Lcom/glympse/android/glympse/ViewSendGlympse$MessageAutoCompleteAdapter;->ms_astrMatrixColumns:[Ljava/lang/String;

    invoke-direct {v6, v7}, Landroid/database/MatrixCursor;-><init>([Ljava/lang/String;)V

    goto :goto_0

    .line 1822
    .end local v2           #oMatrixCursor:Landroid/database/MatrixCursor;
    .restart local v1       #nId:I
    .restart local v3       #oMatrixCursor:Landroid/database/MatrixCursor;
    .restart local v5       #strConstraint:Ljava/lang/String;
    :cond_3
    :try_start_2
    invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/glympse/platform/common/Message;

    .line 1824
    .local v4, oMessage:Lcom/glympse/platform/common/Message;
    iget-object v7, v4, Lcom/glympse/platform/common/Message;->m_strMessage:Ljava/lang/String;

    invoke-static {v7}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v7

    if-nez v7, :cond_2

    iget-object v7, v4, Lcom/glympse/platform/common/Message;->m_strMessage:Ljava/lang/String;

    invoke-virtual {v7}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v7, v5}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v7

    if-eqz v7, :cond_2

    .line 1826
    const/4 v7, 0x2

    new-array v7, v7, [Ljava/lang/Object;

    const/4 v8, 0x0

    add-int/lit8 v1, v1, 0x1

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v9

    aput-object v9, v7, v8

    const/4 v8, 0x1

    iget-object v9, v4, Lcom/glympse/platform/common/Message;->m_strMessage:Ljava/lang/String;

    aput-object v9, v7, v8

    invoke-virtual {v3, v7}, Landroid/database/MatrixCursor;->addRow([Ljava/lang/Object;)V
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    goto :goto_1

    .line 1830
    .end local v4           #oMessage:Lcom/glympse/platform/common/Message;
    :catch_0
    move-exception v6

    move-object v0, v6

    move-object v2, v3

    .line 1832
    .end local v1           #nId:I
    .end local v3           #oMatrixCursor:Landroid/database/MatrixCursor;
    .end local v5           #strConstraint:Ljava/lang/String;
    .local v0, e:Ljava/lang/Exception;
    .restart local v2       #oMatrixCursor:Landroid/database/MatrixCursor;
    :goto_3
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_2

    .end local v0           #e:Ljava/lang/Exception;
    :cond_4
    move-object v6, v2

    .line 1835
    goto :goto_0

    .line 1830
    :catch_1
    move-exception v6

    move-object v0, v6

    goto :goto_3
.end method
